<!--
 * @Author: xiaotiwen
 * @Date: 2020-05-11 10:00:13
 * @LastEditTime: 2020-05-27 17:02:01
 * @LastEditors: xiaotiwen
 * @FilePath: \eduweb\src\views\practiceManagement\practiceTask\practiceTaskDetails.vue
 * @Description: 实习任务分班详情
 -->
<template>
    <div>
        <wordTable :data="data" :label="label" />
        <div class="practiceTaskDetails_center">
            <p>{{$t('practiceTask.title.resultTitle')}}</p>
        </div>
        <wordTable :data="data.udgPtClassInfos" :label="label1" type="arrays" />
    </div>
</template>

<script>
import wordTable from '../common/wordTable';
import { getDetails } from 'common/src/api/practiceManagement/practiceTask';
export default {
    // 组件名称
    name: 'PracticeTaskDetails',
    // 局部注册的组件
    components: {
        wordTable
    },
    // 组件参数 接收来自父组件的数据
    props: {
        detailsId: {
            type: String,
            default: ''
        }
    },
    // 组件状态值
    data() {
        return {
            data: {
                udgPtClassInfos: []
            }, // 数据类型
            label: [
                [{ label: this.$t('label.schoolTerm'), props: 'yearTerm' }, { label: this.$t('label.grade'), props: 'grade' }],
                [{ label: this.$t('label.major'), props: 'majorName' }, { label: this.$t('practiceTask.label.score'), props: 'credits' }],
                [{ label: this.$t('practiceTask.label.number'), props: 'confirmCount' }, { label: this.$t('fundingManagement.label.courseCode'), props: 'courseCode' }],
                [{ label: this.$t('fundingManagement.label.courseName'), props: 'courseName' }]
            ],
            label1: [
                // [{ label: '课程号：', value: '' }, { label: '人数：', value:  }]
            ]
        };
    },
    // 计算属性
    computed: {},
    // 侦听器
    watch: {},
    /**
    * 在实例初始化之后，组件属性计算之前，如data属性等
    */
    created() {
    },
    /**
    * 在挂载开始之前被调用：相关的 render 函数首次被调用。
    */
    mounted() {
    },
    // 组件方法
    methods: {
        getDetails() {
            let jsonData = {
                id: this.detailsId
            };
            getDetails(jsonData).then(res => {
                this.data = res.data;
                this.label1 = [];
                let jsons = [{ label: this.$t('fundingManagement.label.courseProgramNumber')+'：', value: '' }, { label: this.$t('practiceTask.label.number')+'：', value: '' }];
                this.data.udgPtClassInfos.forEach(item => {
                    let jsons1 = JSON.parse(JSON.stringify(jsons));
                    jsons1[0].value = item.subCourseNo;
                    jsons1[1].value = item.studentCount;
                    this.label1.push(jsons1);
                });
            });
        }
    }
};
</script>
 <style lang="scss" scoped>
.practiceTaskDetails {
    &_center {
        div {
            width: 100%;
            background-color: #ccc;
            margin-top: 24px;
            height: 1px;
        }
        p {
            font-size: 18px;
            color: black;
            font-weight: bold;
            margin: 15px 0;
        }
    }
}
</style>

